<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use app\middleware\AdminLoginAuth;
use app\middleware\ApiAuth;
use app\middleware\RequestLog;
use think\facade\Route;

Route::get('test', 'admin.common/test');


Route::group('admin',function(){
    //非登录操作
    Route::post('login','admin.common/login');

    //文件上传
    Route::post('upload','admin.common/upload');

    //登录后操作
    Route::group(function(){



        Route::get('userInfo','admin.user/userInfo');
        Route::get('logout','admin.user/logout');

        //用户
        Route::get('user/list','admin.user/list');
        Route::post('user/add','admin.user/add');
        Route::post('user/edit','admin.user/edit');
        Route::post('user/delete','admin.user/delete');

        //角色
        Route::get('role/list','admin.role/list');
        Route::get('role/all','admin.role/all');
        Route::post('role/add','admin.role/add');
        Route::post('role/edit','admin.role/edit');
        Route::post('role/delete','admin.role/delete');

        //接口
        Route::get('api/list','admin.api/list');
        Route::post('api/add','admin.api/add');
        Route::post('api/edit','admin.api/edit');
        Route::post('api/delete','admin.api/delete');
        Route::get('api/groups','admin.api/groups');
        Route::get('api/all','admin.api/all');

        //操作记录
        Route::get('operation/list','admin.operation/list');

    })->middleware([AdminLoginAuth::class,ApiAuth::class,RequestLog::class]);
})->allowCrossDomain();